package com.wzapp.sitposture.authentication.exception;

import com.wzapp.sitposture.common.util.ExceptionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator;
import org.springframework.stereotype.Component;

/**
 * 功能: <br/>
 *
 * @author ql
 * @version 0.4
 * @create 2018-06-29 10:59
 **/
@Component
public class WebResponseExceptionTranslator extends DefaultWebResponseExceptionTranslator {

    @Autowired
    private ExceptionUtil eigExceptionUtil;

    @Override
    public ResponseEntity translate(Exception e) throws Exception {

        ResponseEntity responseEntity = super.translate(e);

        return eigExceptionUtil.returnEigResponseEntity(e, responseEntity);
    }

}
